import {
	request,
} from '@/api/request';
const apiList = [
	{
		// /api/user/getopenid
		name: 'getopenid',
		url: '/api/user/getopenid',
		method:'GET'
	},
	{
		// /api/user/getWechatPhone
		name: 'getWechatPhone',
		url: '/api/user/getWechatPhone',
		method:'GET'
	},
	{
		// /api/user/profile
		name: 'profile',
		url: '/api/user/profile'
	},
	{
		// /api/user/index
		name: 'userinex',
		url: '/api/user/index'
	},
	{
		// /api/user/myCollect
		name: 'myCollect',
		url: '/api/user/myCollect',
		method:'GET'
	},
	// /api/index/order
	{
		name: 'myorder',
		url: '/api/index/order',
		method:'GET'
	},
	{
		// /api/user/ourAddress
		name: 'ourAddress',
		url: '/api/user/ourAddress',
		method:'GET'
	},
	{
		// /api/user/getAddress
		name: 'getAddress',
		url: '/api/user/getAddress',
		method:'GET'
	},
	{
		// /api/user/defaultAddress
		name: 'defaultAddress',
		url: '/api/user/defaultAddress',
		method:'GET'
	},
	{
		// /api/user/deleteAddress?id=1
		name: 'deleteAddress',
		url: '/api/user/deleteAddress'
	},
	{
		// /api/user/editAddress
		name: 'editAddress',
		url: '/api/user/editAddress'
	},
	{
		// /api/user/setDefaultAddress
		name: 'setDefaultAddress',
		url: '/api/user/setDefaultAddress',
		
	},
	{
		// /api/user/insertAddress
		name: 'insertAddress',
		url: '/api/user/insertAddress',
	},
	{
		// /api/user/myWallet
		name: 'myWallet',
		url: '/api/user/myWallet',
		method:'GET'
	},
	{
		// /api/index/submitTran
		name: 'submitTran',
		url: '/api/index/submitTran',
	},
	{
		// /api/user/myCode
		name: 'myCode',
		url: '/api/user/myCode',
		method:'GET'
	},
	{
		// /api/user/myIncome
		name: 'myIncome',
		url: '/api/user/myIncome',
		method:'GET'
	},
	{
		// /api/user/moneyDetail
		name: 'moneyDetail',
		url: '/api/user/moneyDetail',
		method:'GET'
	},
	{
		// /api/user/myTeam
		name: 'myTeam',
		url: '/api/user/myTeam',
		method:'GET'
	},
	{
		// /api/user/myPerformance
		name: 'myPerformance',
		url: '/api/user/myPerformance',
		method:'GET'
	},
	{
		// /api/user/incomeDetail
		name: 'incomeDetail',
		url: '/api/user/incomeDetail',
		method:'GET'
	},
	{
		// /api/user/myTx
		name: 'myTx',
		url: '/api/user/myTx',
	},
	{
		// /api/user/finishOrder?id=1
		name: 'finishOrder',
		url: '/api/user/finishOrder',
	},
	{
		// makeWechatCode
		name: 'makeWechatCode',
		url: '/api/user/makeWechatCode',
		method:'GET'
	},
	{
		// /api/index/poster
		name: 'poster',
		url: '/api/index/poster',
		method:'GET'
	},
	{
		// /api/index/reloadPay
		name: 'reloadPay',
		url: '/api/index/reloadPay',
	}
]


module.exports = apiList.reduce((mode, params) => {
	mode[params.name] = (data, token) => request({
		url: params.url,
		method: params.method || 'POST',
		data,
		token
	})
	return mode
}, {})